package pk.nak.requests;

import java.util.ArrayList;
import pk.nak.enums.TossDownURLs;
import pk.nak.responses.AddLocationResponse;
import pk.nak.utils.FormattingUtils;

import com.loopj.android.http.RequestParams;

public class AddLocationRequest extends PostRequest {

	public AddLocationRequest(String placename, String lat,
							String lng, String userid) {
		
		super(TossDownURLs.ADD, null);
		
		RequestParams parms = new RequestParams();

		ArrayList<String> fields = new ArrayList<String>();
		ArrayList<String> values = new ArrayList<String>();
		
		fields.add("placename");
		values.add(FormattingUtils.IntoDBFormat(placename));
		
		fields.add("latitude");
		values.add(FormattingUtils.IntoDBFormat(lat));
		
		fields.add("longitude");
		values.add(FormattingUtils.IntoDBFormat(lng));
		
		fields.add("userid");
		values.add(FormattingUtils.IntoDBFormat(userid));
		
		String ff = FormattingUtils.getJoin(fields, ",");
		String fv = FormattingUtils.getJoin(values, ",");
		
		parms.put("table", "trends_userfavouriateplaces");
		parms.put("fields", ff);
		parms.put("values", fv);

		this.setData(parms);
	}

	public void doRequest(AddLocationResponse responseHandler) {
		super.doRequest(responseHandler);
	}

}
